import Vue from 'vue'
import Router from 'vue-router'
import Login from '@/components/Login'
// 测试页
import ceshi from '@/components/home/ceshi'
import Home from '@/components/home/Home'

// 系统管理
import tyy from '@/components/tyy/tyy.vue'
// 公司管理
import Overview from '@/components/tyy/children/Overview'
import visitfill from '@/components/tyy/children/visitfill'
import query from '@/components/tyy/children/query'
import superwindow from '@/components/tyy/children/superwindow'
import interviewnotfill from '@/components/tyy/children/interviewnotfill'
import interviewsdv from '@/components/tyy/children/interviewsdv'
import crfnotfiled from '@/components/tyy/children/crfnotfiled'
import crfsvdnot from '@/components/tyy/children/crfsvdnot'
import interviewquerynot from '@/components/tyy/children/interviewquerynot'
import crfnotgather from '@/components/tyy/children/crfnotgather'
import crfquerynot from '@/components/tyy/children/crfquerynot'
import querycollect from '@/components/tyy/children/querycollect'
import pdcollect from '@/components/tyy/children/pdcollect'
import morequerycollect from '@/components/tyy/children/morequerycollect'


export default [
  {
    path: '/',
    name: 'Login',
    component: Login
  }, {
    path: '/home',
    name: 'Home',
    component: Home,
    redirect: '/ceshi',
    children: [
      { path: '/ceshi', component: ceshi },
      { path: '/tyy', component: tyy},
      { path: '/tyy/overview', component: Overview},
      { path: '/tyy/visitfill', component: visitfill},
      { path: '/tyy/query', component: query},
      { path: '/tyy/superwindow', component: superwindow},
      { path: '/tyy/interviewnotfill', component: interviewnotfill},
      { path: '/tyy/interviewsdv', component: interviewsdv},
      { path: '/tyy/crfnotfiled', component: crfnotfiled},
      { path: '/tyy/crfsvdnot', component: crfsvdnot},
      { path: '/tyy/interviewquerynot', component: interviewquerynot},
      { path: '/tyy/crfnotgather', component: crfnotgather},
      { path: '/tyy/crfquerynot', component: crfquerynot},
      { path: '/tyy/querycollect', component: querycollect},
      { path: '/tyy/pdcollect', component: pdcollect},
      { path: '/tyy/morequerycollect', component: morequerycollect},
    ]
  }
]

// 路由拦截

// router.beforeEach((to, from, next) => {
//   // 如果访问的 login 页面，直接放行
//   if (to.path === '/') return next()
//   // 获取 token 字符串
//   const tokenStr = window.sessionStorage.getItem('token')
//   // 如果没有 token 字符串，强制跳转到 登录页
//   if (!tokenStr) return next('/')
//   // 证明有 token 字符串，直接放行
//   next()
// })
